package com.kerio.observer.subject;

import com.kerio.observer.core.EventListener;

/**
 * Created by hetao on 2018/3/21.
 * 被观察者
 */
public class Subject extends EventListener{
    //采用动态代理，实现监控
    public void add(){
        System.out.println("调用添加的方法");
        trigger(SubjectEventType.ON_ADD);
    }

    public void delete(){
        System.out.println("调用删除的方法");
        trigger(SubjectEventType.ON_DELETE);
    }

    public void update(){
        System.out.println("调用修改的方法");
        trigger(SubjectEventType.ON_UPDATE);
    }

    public void query(){
        System.out.println("调用查询的方法");
        trigger(SubjectEventType.ON_QUERY);
    }
}
